<template>
    <div class="setting-container bg_init_pages">
        <menuCom @menuClick="menuClick" :inMenuData="currentMenu"></menuCom>
        <componentsCom :currentMenu="currentMenu"></componentsCom>
    </div>
</template>

<script setup>
import { onMounted, ref, getCurrentInstance } from '@vue/composition-api'
const { proxy } = getCurrentInstance()
import menuCom from "./components/menu.vue"
import componentsCom from "./components/components.vue"

// 当前选中的菜单
const currentMenu = ref(
    {
        id: 'myCompany',
        text: '我的企业',
        icon: '🏬',
		permission: true
    }
)

const menuData = [
    {
        id: 'accSecury',
        text: '账号与安全',
        icon: '⚙️',
    },
    {
        id: 'myCompany',
        text: '我的企业',
        icon: '🏬',
    },

    {
        id: 'storeManage',
        text: '门店管理',
        icon: '📚',
    },
    {
        id: 'warehouseManage',
        text: '仓库管理',
        icon: '📈',
    },
    {
        id: 'memberManage',
        text: '成员管理',
        icon: '👥',
    },
    {
        id: 'customerSetting',
        text: '客户设置',
        icon: '💼',
    },
    {
        id: 'supplierSetting',
        text: '供应商设置',
        icon: '🧪',
    },
    {
        id: 'salesSetting',
        text: '销售设置',
        icon: '🚀',
    },
    {
        id: 'procureSetting',
        text: '采购设置',
        icon: '📊',
    },
    {
        id: 'warehouseManageSetting',
        text: '库管设置',
        icon: '🛠️',
    },
    {
        id: 'yuyueSetting',
        text: '预约设置',
        icon: '🔔',
    },
    {
        id: 'basicSetting',
        text: '基础设置',
        icon: '🛠️',
    },
    {
        id: 'helper',
        text: '帮助中心',
        icon: '📚',
        permission: true
    },
]

const menuClick = (menu) => {
    currentMenu.value = menu
}

onMounted(() => {
    let menuId = proxy.$route?.query?.id
    if (menuId) {
        menuData.forEach(item => {
            if (item.id == menuId) {
                currentMenu.value = item
            }
        })
    }
    // 初始化环境配置
    uni.setLeftWindowStyle({ width: "72px" });
})

</script>

<style lang="scss" scoped>
.setting-container {
    height: 100vh;
    display: flex;
    flex-direction: row;
    overflow: hidden;
}
</style>